package com.lm.csv.example;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;

import java.io.FileWriter;

public class CustomDelimiterExample {
    public static void main(String[] args) throws Exception {
        try (FileWriter writer = new FileWriter("e:\\csv\\custom_delimiter.csv");
             CSVPrinter printer = new CSVPrinter(writer, CSVFormat.DEFAULT
                     .withHeader("ID", "Name", "Age", "Email")
                     .withDelimiter(':'))) {

            printer.printRecord("1", "Diana", "40", "diana@example.com");
            printer.printRecord("2", "Eve", "22", "eve@example.com");
        }
    }
}
